import utils from '@/mixins/utils.js';
export default {
  name: '',
  props: ['parkId'],
  mixins: [utils],
  data() {
    return {
      parkCloudDetailVo: null,
      checkInReason: null,
      checkOutReason: null,
      remainFreeParkingTime: 0,
      limitVo: null,
      featureData: null,
      parkCarNoForceCovertConfigVoList: [],
      isShowMore: false
    };
  },
  created() {
    this.getOperatorParkConfigInfo();
  },

  methods: {
    getOperatorParkConfigInfo() {
      var params = {
        parkID: this.parkId
      };
      API.fetchGet('/operatorPark/getOperatorParkConfigInfo', params).then(
        res => {
          if (!res.data) {
            return;
          }

          this.featureData = res.data;

          this.limitVo = res.data.limitVo;

          if (res.data.parkCloudDetailVo) {
            this.parkCloudDetailVo = res.data.parkCloudDetailVo;
            if (this.limitVo.openFullLimit || this.limitVo.openNormalLimit || this.limitVo.openVipLimit) {
              this.parkCloudDetailVo.openFullLimit = true;
            }
          }

          if (res.data.parkCloudDetailVo.carNoForceCovertFlag && res.data.parkCarNoForceCovertConfigVoList.length) {
            res.data.parkCarNoForceCovertConfigVoList.forEach(item => {
              item.covertSrcCarNo = JSON.parse(item.covertSrcCarNo);
            });
            this.parkCarNoForceCovertConfigVoList = res.data.parkCarNoForceCovertConfigVoList;
          }

          if (res.data.checkInReason && res.data.checkInReason.length) {
            this.checkInReason = res.data.checkInReason;
          }

          if (res.data.checkOutReason && res.data.checkOutReason.length) {
            this.checkOutReason = res.data.checkOutReason;
          }

          if (res.data.remainFreeParkingTime) {
            this.remainFreeParkingTime = res.data.remainFreeParkingTime;
          }
        },
        err => {}
      );
    },
    linkToEdit() {
      this.$router.push({
        name: 'editParkinglotFeature',
        query: this.$route.query
      });
    }
  }
};
